package com.blue.bluecode;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.blue.bluecode.service.MyIntentService;


public class MainActivity extends Activity implements View.OnClickListener{

    protected Button btnHello;
    protected Button btnCvRv;
    protected Button btnUiWidgets;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initView();

        Intent intent;
        for(int i = 0; i < 10; i++){
            intent = new Intent(this, MyIntentService.class);
            intent.putExtra("xys", "" + i);
            startService(intent);
        }

    }

    private void initView() {
        btnHello = (Button) findViewById(R.id.btnHello);
        btnCvRv = (Button) findViewById(R.id.btnCvRv);
        btnUiWidgets = (Button) findViewById(R.id.btnUiWidgets);
        btnHello.setOnClickListener(this);
        btnCvRv.setOnClickListener(this);
        btnUiWidgets.setOnClickListener(this);
    }


    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.btnHello:
                startActivity(new Intent(MainActivity.this, AsyncLoaderActivity.class));
                break;
            case R.id.btnCvRv:
                startActivity(new Intent(MainActivity.this, RecyclerViewActivity.class));
                break;
            case R.id.btnUiWidgets:
                startActivity(new Intent(MainActivity.this, UiWidgetsActivity.class));
                break;
        }
    }
}
